/*
 * Macro.h
 *
 *  Created on: 2011-3-1
 *      Author: Dallas Cao
 */

#ifndef MACRO_H_
#define MACRO_H_

#define	DELETEPTR(x)		if(x) { delete x; x = NULL; }
#define	DELETEARR(x)		if(x) { delete[] x; x = NULL; }
#define	RELEASE(x)			if(x) { x->Release(); x=NULL; }
#define	FREE(x)				if(x) { free(x); x=NULL; }
#define	FCLOSE(x)			if(x) { fclose(x); x=NULL; }
//#define	GDIDELETE(x)		if(x) { ::DeleteObject(x); x=NULL; }
//#define	CLOSEHANDLE(x)		if(x) { ::CloseHandle(x); x = NULL; }

#define	ZEROMEMORY(p,s)		::memset( (p), 0, (s) )

#define	RCWIDTH(rc)			((rc).right-(rc).left)
#define	RCHEIGHT(rc)		((rc).bottom-(rc).top)

#endif /* MACRO_H_ */
